package com.rd.student.jiaji.class3.sunguowei.day0802.CountPractice;

import java.util.Arrays;

//创建一个接受数字数组并仅返回偶数值的函数。
public class Count1 {
    public static int[] OuShu(int[] arr){
        int OuShu=0;
        boolean flag=false;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]%2==0){
                arr[OuShu]=arr[i];
                OuShu++;
                 flag=true;
            }
            if(flag){

                continue;

            }

        }
        return arr;
    }

    public static void main(String[] args) {
        int arr[]={1,2,3,4,5,6,7,8,9};

        System.out.println(Arrays.toString(OuShu(arr)));
    }
}
